<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="input-group">
                <span class="input-group-append">
                    <button class="btn btn-warning" type="button" id="btnSearch">备案查询</button>
                </span>
                <input id="txtSearch" type="text" class="form-control" placeholder="请输入顶级域名，不带http、www" autocomplete="off">
            </div>
            <div class="mt-3" id="dn"></div>
        </div>
    </div>
</div>

<script>
    $("#txtSearch").keydown(function (e) {
        e = e || window.event;
        var keys = e.keyCode || e.which || e.charCode;
        keys == 13 && $("#btnSearch")[0].click();
    })[0].focus();
    $("#btnSearch").click(QueryDomainName);
    function QueryDomainName() {
        if ($("#txtSearch").val() == "") {
            jz.tip({
                target: "#txtSearch",
                content: "请输入域名",
                align: "bottom",
                time: 4,
                blank: true,
                focus: true
            })
            return
        }

        ss.loading();
        ss.ajax({
            url: "https://whois.west.cn/icp/" + encodeURIComponent($("#txtSearch").val()),
            success: function (data) {
                var jw = $(data);

                var v1 = jw.find('.info-table').first();
                v1.addClass('table');
                if (v1.length) {
                    $('#dn').html('').append(v1);
                } else {
                    $('#dn').html('<p class="text-muted">无备案信息（' + $("#txtSearch").val() + '）</p>');
                }
            },
            error: function () {
                ss.loading(0);
                jz.msg("网络错误");
            },
            complete: function () {
                ss.loading(0);
            }
        }, 0)
    }
</script>